<?php namespace Home\Controller;
use Hdphp\Controller\Controller;
class LoginController extends Controller{

	
	public function index(){
		if(IS_POST){
              $username = $_POST['u_account'];
			  $password = $_POST['u_password'];
			  $data = Db::table('360mall_user')->where('u_account',"$username")
			  ->where("u_password","$password")
			  ->first();
//			  p($data);
			if($data){
				    $_SESSION['uid']=$data['u_id'];
					$_SESSION['u_account']=$data['u_account'];
					$_SESSION['u_username']=$data['u_username'];
					View::success("登录成功",U("Index/index"));
			 	}else{
			 		View::success("用户名或密码错误",U("Index/index"));
				};

		}
	}
	public function out(){
	    session_unset();
		session_destroy();
	    go(U("Index/index"));
	}
}
 ?>